<template>
  <a-drawer
    width="576"
    :title="formTitle"
    :label-col="4"
    :wrapper-col="14"
    :visible="open"
    :body-style="{height:'calc(100vh - 100px)',overflow:'auto'}"
    @close="cancel">
    <a-form-model ref="form" :model="form" :rules="rules" layout="vertical">
      <a-spin :spinning="spinning" :delay="delayTime" tip="Loading...">
        <a-row :gutter="32">
          <a-col :span="12">
            <a-form-model-item label="分段序号" prop="partIndex">
              <a-input-number v-model="form.partIndex" :min="0" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="分段类型" prop="partType">
              <a-select
                placeholder="请选择分段类型"
                v-model="form.partType"
                :getPopupContainer="
                  triggerNode => {
                    return triggerNode.parentNode || document.body
                  }
                "
                style="width: 100%"
                allow-clear>
                <a-select-option v-for="(d, index) in partTypeOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="分段编号" prop="partCode">
              <a-input v-model="form.partCode" placeholder="请输入分段编号"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="分段名称" prop="partName">
              <a-input v-model="form.partName" placeholder="请输入分段名称"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="分段长度" prop="partLength">
              <a-input-number v-model="form.partLength" :min="0" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="日期时间格式" prop="dateFormat">
              <a-input v-model="form.dateFormat" placeholder="请输入日期时间格式"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="输入字符" prop="inputCharacter">
              <a-input v-model="form.inputCharacter" placeholder="请输入输入字符"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="固定字符" prop="fixCharacter">
              <a-input v-model="form.fixCharacter" placeholder="请输入固定字符"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="流水号起始值" prop="seriaStartNo">
              <a-input-number v-model="form.seriaStartNo" :min="0" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="流水号步长" prop="seriaStep">
              <a-input-number v-model="form.seriaStep" :min="0" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12">
            <a-form-model-item label="流水号当前值" prop="seriaNowNo">
              <a-input-number v-model="form.seriaNowNo" :min="0" style="width: 100%"/>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="流水号是否循环" prop="cycleFlag">
              <a-radio-group v-model="form.cycleFlag" button-style="solid">
                <a-radio-button
                  v-for="(dict, index) in cycleFlagOptions"
                  :key="index"
                  :value="dict.dictValue"
                >
                  {{ dict.dictLabel }}
                </a-radio-button>
              </a-radio-group>
            </a-form-model-item>
          </a-col>
          <a-col :span="12" >
            <a-form-model-item label="循环方式" prop="cycleMethod">
              <a-select
                placeholder="请选择循环方式"
                v-model="form.cycleMethod"
                :getPopupContainer="
                  triggerNode => {
                    return triggerNode.parentNode || document.body
                  }
                "
                style="width: 100%"
                allow-clear>
                <a-select-option v-for="(d, index) in cycleMethodOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
              </a-select>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-spin>
      <div class="bottom-control">
        <a-space>
          <a-button :disabled="disabled" @click="cancel">
            取消
          </a-button>
          <a-button type="primary" :disabled="disabled" @click="submitForm(true)">
            保存
          </a-button>
        </a-space>
      </div>
    </a-form-model>
  </a-drawer>
</template>
<script>
import SysAutoCodePartEditForm from './SysAutoCodePartForm'
export default {
  ...SysAutoCodePartEditForm
}
</script>
